﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace com.kmer {
	/// <summary>
	/// 单例发生器.
	/// </summary>
	/// <typeparam name="T"></typeparam>
	/// where T : new()是指然后T的限制为必须要有一个无参构造器
	public class SingletonProvider<T> where T : new() {
		private SingletonProvider() { }
		/// <summary>
		/// 
		/// </summary>
		public static T Instance {
			get { return SingletonCreator.instance; }
		}

		class SingletonCreator {
			internal static readonly T instance = new T();
		}

	}
}
